<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<title>Simulations for Statistical and Thermal Physics</title>

<link href="../../default.css" type="text/css" rel="stylesheet">

</head>

<body>
<h3 style="text-align:center;">One-dimensional random walk</h3>

<p class="header_title">Introduction</p>

<p>The program simulates a random walk in one dimension. A walker starts at the origin and takes N steps. At each step the walker goes to the right with probability p and to the left with probability (1 - p). Each step is the same length and independent of the previous steps. What is the displacement of the walker after N steps? Because of the many random choices of the walker, the final position of the walker varies each time the simulation is done. Are some displacements more likely than others?</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;We can determine the answer to this question by performing a large number of trials, where each trial consists of a N step walk. At the end of each trial, the displacement x of the walker from the origin is recorded. We then construct a histogram for the number of times that the displacement x is recorded for a given number of trials. The probability that the walker will be a distance x from the origin after N steps is proportional to the corresponding value of the histogram.</p>
<center>
<applet
 code="org.opensourcephysics.davidson.applets.ApplicationApplet.class"
 archive="./stp.jar" codebase="../" align="top" height="40"
 hspace="0" vspace="0" width="150"> <param name="target"
 value="org.opensourcephysics.stp.randomwalk.randomwalk1.OneDimensionalWalkApp"> <param name="title"
 value="Applet"> <param name="singleapp" value="true">
</applet>
</center>

<p class="header_title">Algorithm</p>

<p>The program constructs a histogram by performing a large number of trials. 
At the end of each trial, the appropriate histogram entry is incremented, that is H(x) = H(x) + 1. Note that the horizontal axis ranges from x = -N to N.
The default probability is p = 1/2 which represents an equal probability of going to the right 
or to the left and generates a symmetric distribution. The number of steps N in one walk can also be changed. </p>

<p class="header_title">Problems</p>

<ol>

<li>How does the histogram change, if at all, as the number of trials increases for fixed N?</li>

<li>Describe the qualitative changes of the histogram for increasing values of N.</li>

<li>What is the most probable value of x for p = 1/2 and N = 16 and N = 32?</li>

<li>What is the approximate width of the distribution for p = 1/2 and N = 16? Define the width visually. One way to do so is to determine the value of x at which the value of the histogram is one-half of its maximum value. How does the width change as a function of N for fixed p?</li>

</ol>

<p class="header_title">Java Classes</p>

<ul>

<li>OneDimensionalWalkApp</li>

</ul>

<p class = "small">Updated 10 February 2007.</p>
</body>
</html>